﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class App_Common_UserControls_Cart : System.Web.UI.UserControl
{
    private Asah.SiteWorx.Commerce.ShoppingCart MyShoppingCart
    {
        get
        {
            return (Asah.SiteWorx.Commerce.ShoppingCart)Session["MyCart"];
        }
    }
              
    protected override void OnPreRender(System.EventArgs e)
    {
        UpdateCartLabel();
    }

    private void UpdateCartLabel()
    {
        // Update the cart label.
        if (MyShoppingCart == null)
            lblCartItems.Text = "(0 items)";
        else
            lblCartItems.Text = "(" + MyShoppingCart.GetCartQuantity().ToString() + " items)";
    }
}
